import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store/index";
import ViserVue from "viser-vue";
import components from "./components";
import { getStorage } from "./utils/storage";
import { GlobalStore } from "./store/global";

import { createFormModal } from "@/components/Modal/createModal";
import { Api } from "./services";
import "@/directive";

import antd from "ant-design-vue";
import "ant-design-vue/dist/antd.css";

import moment from "moment";
import "moment/locale/zh-cn";
moment.locale("zh-cn");

import vcolorpicker from "vcolorpicker";

Vue.use(vcolorpicker);

Vue.use(antd);
Vue.use(ViserVue);
Vue.use(components);

Vue.prototype.Api = Api;
Vue.prototype.moment = moment;
Vue.prototype.$createFormModal = createFormModal;

Vue.config.productionTip = false;
GlobalStore.saveAsyncRoutes(getStorage("asyncRoutes"));

new Vue({
    el: "#App",
    router,
    store,
    render: h => h(App),
    mounted() {
        (window as any).vue = this;
    }
});
